<html>
<head>
	<link type="text/css" rel="stylesheet" href="../css/default.css" />
    <link type="text/css" rel="stylesheet" href="../js/rainbow/themes/sunburst.css">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
	<div class="page">
<h2>IgePathComponent <span>CLASS</span></h2>
<p>Declared in <a href="../../engine/components/IgePathComponent.js">IgePathComponent.js</a></p>
<div class="itemBox">
	<div class="header">Description</div>
	<div class="content">Handles entity path traversal.</div>
</div>
<!--=if{extends}[-->
<div class="itemBox">
	<div class="header">Extends</div>
	<div class="content"><a href="IgeEventingClass.html">IgeEventingClass</a></div>
</div>
<!--=if{extends}]-->
<h2>Methods</h2><a name="add"></a>
<h3 class="methodTitle">add</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Adds a path array containing path points (IgePoint instances) to the path queue.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">add</span>({<span class="argType">Array</span>} <span class="argName">path</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Array</span>}<span class="argName">path</span> </li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="current"></a>
<h3 class="methodTitle">current</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the current path index that the pathing system is traversing.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">current</span>({<span class="argType">Number</span>} <span class="argName">index</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Number</span>}<span class="argName">index</span> </li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="previousTargetPoint"></a>
<h3 class="methodTitle">previousTargetPoint</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets the path node point that the entity is travelling from.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">previousTargetPoint</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">IgePoint</span>} A new point representing the travelled from node.</div>
    
</div><a name="currentTargetPoint"></a>
<h3 class="methodTitle">currentTargetPoint</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets the path node point that the entity is travelling to.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">currentTargetPoint</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">IgePoint</span>} A new point representing the travelling to node.</div>
    
</div><a name="currentDirection"></a>
<h3 class="methodTitle">currentDirection</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets the current direction.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">currentDirection</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">String</span>} A string such as N, S, E, W, NW, NE, SW, SE. If there is currently no direction then the return value is a blank string.</div>
    
					<div class="methodExample">
						<div class="content"><h1>Get the direction of movement along the current path</h1>

<pre><code>// Create an entity and add the path component
var entity = new IgeEntity()
    .addComponent(IgePathComponent);

// Create a path and add it to the entity
// ...
// Now get the current direction
var direction = entity.path.currentDirection();
</code></pre>
</div>
					</div>
				
</div><a name="warnTime"></a>
<h3 class="methodTitle">warnTime</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the time towards the end of the path when the path component will emit a "almostComplete" event.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">warnTime</span>({<span class="argType">Number</span>} <span class="argName">ms</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Number</span>}<span class="argName">ms</span> The time in milliseconds to emit the event on before the end of the path.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="autoStop"></a>
<h3 class="methodTitle">autoStop</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the flag determining if the entity moving along the path will stop automatically at the end of the path.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">autoStop</span>({<span class="argType">Boolean</span>} <span class="argName">val</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Boolean</span>}<span class="argName">val</span> If true, will stop at the end of the path.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="drawPath"></a>
<h3 class="methodTitle">drawPath</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the flag determining if the path component should draw the current path of the entity to the canvas on each tick. Useful for debugging paths.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">drawPath</span>({<span class="argType">Boolean</span>} <span class="argName">val</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Boolean</span>}<span class="argName">val</span> If true, will draw the path.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="drawPathGlow"></a>
<h3 class="methodTitle">drawPathGlow</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the flag that determines if the path that is drawn gets some added glow effects or not. Pure eye candy, completely pointless otherwise.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">drawPathGlow</span>({<span class="argType">Boolean</span>} <span class="argName">val</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Boolean</span>}<span class="argName">val</span> If true will add glow effects to the path.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="drawPathText"></a>
<h3 class="methodTitle">drawPathText</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the flag that determines if the path that is drawn gets some added labels or not.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">drawPathText</span>({<span class="argType">Boolean</span>} <span class="argName">val</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Boolean</span>}<span class="argName">val</span> If true will draw labels on each path point.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="speed"></a>
<h3 class="methodTitle">speed</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Gets / sets the speed at which the entity will traverse the path.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">speed</span>({<span class="argType">Number</span>} <span class="argName">val</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Number</span>}<span class="argName">val</span> </li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="start"></a>
<h3 class="methodTitle">start</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Starts path traversal.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">start</span>({<span class="argType">Number</span>} <span class="argName">startTime</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">Number</span>}<span class="argName">startTime</span> The time to start path traversal. Defaults to new Date().getTime() if no value is presented.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="endPoint"></a>
<h3 class="methodTitle">endPoint</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Returns the last point of the last path in the path queue.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">endPoint</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">IgePoint</span>} </div>
    
</div><a name="pause"></a>
<h3 class="methodTitle">pause</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Pauses path traversal but does not clear the path queue or any path data.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">pause</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="stop"></a>
<h3 class="methodTitle">stop</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Stops path traversal but does not clear the path queue or any path data.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">stop</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="clear"></a>
<h3 class="methodTitle">clear</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Clears all path queue and path data.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">clear</span>()</div>
    <div class="methodArgs"></div>
    <div class="methodReturnDesc">Returns {<span class="argType">*</span>} </div>
    
</div><a name="_updateBehaviour"></a>
<h3 class="methodTitle">_updateBehaviour</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">The behaviour method executed each tick.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">_updateBehaviour</span>({<span class="argType">CanvasRenderingContext2d</span>} <span class="argName">ctx</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType">CanvasRenderingContext2d</span>}<span class="argName">ctx</span> The canvas that is currently being rendered to.</li></ul></div>
    <div class="methodReturnDesc"></div>
    
</div><a name="_positionAlongVector"></a>
<h3 class="methodTitle">_positionAlongVector</h3>
<div class="methodSection">
    <!--=if{desc}[-->
    <div class="methodDesc">Calculates the position of the entity along a vector based on the speed of the entity and the delta time.</div>
    <!--=if{desc}]-->
    <div class="methodDefinition"><span class="methodName">_positionAlongVector</span>({<span class="argType"><a href="./IgePoint.html">IgePoint</a></span>} <span class="argName">p1</span>, {<span class="argType"><a href="./IgePoint.html">IgePoint</a></span>} <span class="argName">p2</span>, {<span class="argType">Number</span>} <span class="argName">speed</span>, {<span class="argType">Number</span>} <span class="argName">deltaTime</span>)</div>
    <div class="methodArgs"><ul class="argList"><li>{<span class="argType"><a href="./IgePoint.html">IgePoint</a></span>}<span class="argName">p1</span> Vector starting point</li><li>{<span class="argType"><a href="./IgePoint.html">IgePoint</a></span>}<span class="argName">p2</span> Vevtor ending point</li><li>{<span class="argType">Number</span>}<span class="argName">speed</span> Speed along the vector</li><li>{<span class="argType">Number</span>}<span class="argName">deltaTime</span> The time between the last upadte and now.</li></ul></div>
    <div class="methodReturnDesc">Returns {<span class="argType">IgePoint</span>} </div>
    
</div>	</div>
    <script type="text/javascript">
        $(function () {
            $('code').attr('data-language', 'javascript');
        });
    </script>
    <script type="text/javascript" src="../js/rainbow/rainbow-custom.min.js"></script>
</body>
</html>